<div class="x_panel" >
    <div class="form-inline">
        <div class="form-group">
            <label>样式名称 </label>
            <input type="text" ng-model="dict.search.name"  class="form-control" />
        </div>
        <div class="form-group">
            <label>样式Id </label>
            <input type="number" ng-model="dict.search.code"  class="form-control" />
        </div>
        <button class="btn btn-primary" ng-click="find(1)" >查询</button>
        <button class="btn btn-default" ng-click="dict.search={}" >重置</button>
    </div>
</div>

<table class="table table-bordered table-striped table-hover scroll" style="margin-bottom: 0" >
    <thead class="title" >
    </thead>
    <tbody ng-class="{'showAll':dict.showAll}">
    <tr ng-repeat-start="style in dict.styles"></tr>
    <tr ng-class="{'mayHide':!style.data || style.data.length == 0}" ><td colspan="100" style="padding: 0" class="panel-warning">
        <div style="margin-top: 10px;    border: 1px solid #faebcc;box-shadow: 0 1px 1px rgba(0,0,0,.05);border-bottom: none;" class="text-center panel-heading">
            <span th-check items="style.data" uib-tooltip="全选"class="pull-left" style="margin-left:28px;"></span>


            <style-type-edit style-type="dict" host="style"   field="'tagForModify'"><label uib-tooltip="tag-for-modify" class="btn-link" style="margin-left: 15px;">{{(style.text||style.name)+"_"+style.code}}:</label>{{style.tagForModify}}</style-type-edit>
            <i class="fa fa-fw fa-angle-up text" role="button" ng-click="style.showTitle=!style.showTitle" ng-class="{'text-active':style.showTitle,'fa-angle-up':style.showTitle,'fa-angle-down':!style.showTitle}" ></i>
            <style-type-edit ng-if="style.textStyleID" style-type="dict" host="style"   field="'textTag'"><label uib-tooltip="tag-for-modify" class="btn-link" style="margin-left: 15px;">{{style.textName+"_"+style.textStyleID}}:</label>{{style.textTag}}</style-type-edit>
            <span ng-if="$root.hasPower('style',curInstance.id)">
                 <button class="btn btn-primary pull-right" ng-click="addRule(style)">添加</button>
                 <button class="btn btn-info pull-right" ng-click="combineRules(dict,style)">合并或拆分</button>
                 <button class="btn btn-success pull-right" ng-click="copyStyle(dict,style)">复制</button>
            </span>
        </div>
    </td></tr>
    <tr ng-if="style.showTitle">
        <th class="text-center">NO</th>
        <th  class="text-center" style="width:20px"><i role="button" uib-tooltip="取消选中" ng-click="unCheckAll(dict.ruleList)" class="text-danger glyphicon glyphicon-ban-circle text"></i></th>
        <th style="width: 100px"><span uib-tooltip="scale">级别</span></th>
        <th><group-edit style-type="dict" host="style"  field-type="'icon'"  field="'iconName'"  ><span uib-tooltip="icon-name">图标</span></group-edit></th>
        <th><group-edit style-type="dict"  host="style" field-type="'arrayDict'" array-dict="$root.poiTypeDict"  field="'poiType'"><span uib-tooltip="poi_type">点类型</span></group-edit></th>
        <th style="width: 100px"><group-edit style-type="dict"  host="style" field-type="'number'" field="'pointDensity'"  ><span uib-tooltip="density">旁白</span></group-edit></th>
        <th><group-edit style-type="dict"  host="style" field-type="'arrayDict'" array-dict="$root.yesNoDict" field="'allowOverlap'"  ><span uib-tooltip="allow-overlap">允许压盖</span></group-edit></th>
        <th><group-edit style-type="dict"  host="style" field-type="'objDict'" obj-dict="listDicts('font')" field="'fontName'"  ><span uib-tooltip="font-name">字体名称</span></group-edit></th>
        <th><group-edit style-type="dict"  host="style" field-type="'objDict'" obj-dict="listDicts('fontSize')" field="'fontSize'"  ><span uib-tooltip="font-size">字体大小</span></group-edit></th>
        <th><group-edit style-type="dict"  host="style" field-type="'color'" field="'fontColor'"  ><span uib-tooltip="font-color">字体前景色</span></group-edit></th>
        <th><group-edit style-type="dict"  host="style" field-type="'arrayDict'" array-dict="$root.fontWeightDict" field="'fontWeight'"  ><span uib-tooltip="font-weight">字体粗细</span></group-edit></th>
        <th><group-edit style-type="dict"  host="style" field-type="'arrayDict'" array-dict="$root.fontStyleDict" field="'fontStyle'"  ><span uib-tooltip="font-style">字体样式</span></group-edit></th>
        <th><group-edit style-type="dict"  host="style" field-type="'number'" field="'halosize'"  ><span uib-tooltip="halosize">光晕密度</span></group-edit></th>
        <th><group-edit style-type="dict"  host="style" field-type="'number'" field="'bgsize'"  ><span uib-tooltip="bgsize">背景框加边</span></group-edit></th>
        <th><group-edit style-type="dict"  host="style" field-type="'color'" field="'halocolor'"  ><span uib-tooltip="halocolor">光晕</span></group-edit></th>
        <th><group-edit style-type="dict"  host="style" field-type="'number'" field="'density'"  ><span uib-tooltip="density">文字疏密度</span></group-edit></th>
        <th><group-edit style-type="dict"  host="style" field-type="'number'" field="'fillarc'"  ><span uib-tooltip="fillarc">圆弧大小</span></group-edit></th>
        <th style="width:120px" ng-show="$root.hasPower('style',curInstance.id)" >操作</th>
    </tr>
    <tr ng-class="{'mayHide':!style.data || style.data.length == 0}" ng-if="!style.data || style.data.length == 0">
        <td colspan="100" class="text-center">暂无记录</td>
    </tr>
    <tr ng-repeat-start="item in style.data" ng-if="!item.edit" ng-class="{'bg-success': item.checked}">
        <td class="text-center">{{$index + 1}}</td>
        <td td-check item="item"></td>
        <td>{{item.scale}}</td>
        <!--   <td style="position: relative">
                           <span role="button" class="btn-link"
                                 popover-class="popoverMax" popover-is-open="curTextStyle.ruleId == item.id"
                                 popover-trigger="'none'"
                                 ng-click="setCurTextStyle(item,item.textName)"
                                 uib-popover-template="'view/instance/textStyle.html'">
                               {{item.textName|textFilter:curInstance}}</span></td>-->
        <!--popover-trigger="'outsideClick'"-->
        <td><div lazy-src="{{item.iconName}}" /></td>
        <td>{{item.poiType|keyToValue:$root.poiTypeDict}}</td>
        <td>{{item.pointDensity}}</td>
        <td>{{item.allowOverlap|keyToValue:$root.yesNoDict}}</td>
        <td>{{item.fontName|fontFilter:curInstance}}</td>
        <td>{{item.fontSize|fontSizeFilter:curInstance}}</td>
        <td color-trans color-id="item.fontColor" instance='curInstance' element-id="dict.id"></td>
        <td>{{item.fontWeight|keyToValue:$root.fontWeightDict}}</td>
        <td>{{item.fontStyle|keyToValue:$root.fontStyleDict}}</td>
        <td>{{item.halosize}}</td>
        <td>{{item.bgsize}}</td>
        <td color-trans color-id="item.halocolor" instance='curInstance' element-id="dict.id"></td>
        <td>{{item.density}}</td>
        <td>{{item.fillarc}}</td>
        <td ng-if="$root.hasPower('style',curInstance.id)">
            <ng-include src="'view/instance/style_edit_buttons.html'"></ng-include>
        </td>
    </tr>
    <tr ng-repeat-end ng-if="item.edit" ng-form name="form" novalidate>
        <td class="text-center">{{$index + 1}}</td>
        <td td-check item="item"></td>
        <td>
            <input type="text" class="form-control" ng-model="item.copy.scale" ng-pattern="/^[\d]+,[\d]+$/i" required>

        </td>
        <!--  <td>
              <select class="form-control" ng-model="item.copy.textName"
                      ng-options="o.id as o.name for o in listStyles('PointTextSymbolizer')">
                  <option value="">&#45;&#45;请选择&#45;&#45;</option>
              </select>
          </td>-->
        <td> <icon-edit host="item.copy" key="'iconName'" ></icon-edit> </td>
        <td><select class="form-control" ng-model="item.copy.poiType" required
                    ng-options="o[0] as o[1] for o in $root.poiTypeDict">
            <option value="">--请选择--</option>
        </select>
        </td>
        <td><input type="number" class="form-control" ng-model="item.copy.pointDensity" required></td>
        <td><select class="form-control" ng-model="item.copy.allowOverlap" required
                    ng-options="o[0] as o[1] for o in $root.yesNoDict">
            <option value="">--请选择--</option>
        </select></td>
        <td><select class="form-control" ng-model="item.copy.fontName"
                    ng-options="o.id as o.name for o in listDicts('font')">
            <option value="">--请选择--</option>
        </select>
        </td>
        <td><select class="form-control" ng-model="item.copy.fontSize"
                    ng-options="o.id as o.name for o in listDicts('fontSize')">
            <option value="">--请选择--</option>
        </select>
        </td>
        <td>
            <color-selector host="item.copy" key="'fontColor'" instance='curInstance'
                            element-id="dict.id"></color-selector>
        </td>
        <td><select class="form-control" ng-model="item.copy.fontWeight"
                    ng-options="o[0] as o[1] for o in $root.fontWeightDict">
            <option value="">--请选择--</option>
        </select>
        </td>
        <td><select class="form-control" ng-model="item.copy.fontStyle"
                    ng-options="o[0] as o[1] for o in $root.fontStyleDict">
            <option value="">--请选择--</option>
        </select>
        </td>
        <td><input type="number" class="form-control" ng-model="item.copy.halosize" ></td>
        <td><input type="number" class="form-control" ng-model="item.copy.bgsize" ></td>
        <td>
            <color-selector host="item.copy" key="'halocolor'" instance='curInstance'
                            element-id="dict.id"></color-selector>
        </td>
        <td><input type="number" class="form-control" ng-model="item.copy.density" ></td>
        <td><input type="number" class="form-control" ng-model="item.copy.fillarc" ></td>
        <td>
            <a href='javascript:void(0)' ng-click="saveRule(form,item,'../rule/saveRulePoint',style)"
               class='btn btn-xs btn-link text-primary'><span class='fa fa-save'></span>保存</a>
            <a href='javascript:void(0)' ng-click="cancelRule(style,item)"
               class='btn btn-xs btn-link text-danger'><span class='fa fa-undo'></span>取消</a>
        </td>
    </tr>
    <tr ng-repeat-end ng-if="false"></tr>
    </tbody>

</table>
<div class="clearfix" >
    <page  page-model="dict.pageModel"></page>
</div>